#ifndef _HUFFMAN_H
#define _HUFFMAN_H

#include <stdlib.h>
#include <inttypes.h>

typedef struct _huffmanTree huffmanTree;
typedef struct _huffmanTreeList huffmanTreeList;
typedef struct _encodingTable eTable;
typedef struct _charTable charTable;

struct _huffmanTree {
    int  count;
    char letter;
    huffmanTree *left, *right;
}; 


struct _huffmanTreeList {
    huffmanTree *huffman;
    huffmanTreeList *next; 
};

struct _encodingTable{
	char letter;
	char value[16];
};

struct _charTable{
	char letter;
	uint16_t count;
};

void printHuffmanCodes(const huffmanTree * t);
void printHuffmanCodesAux(const huffmanTree * t, char * code_ptr, char * code);
void printHuffmanTree(const huffmanTree * t, int level, char type);
void printHuffmanTreeList(huffmanTreeList * l);
void freeHuffmanTree(huffmanTree * t);
void freeHuffmanTreeList(huffmanTreeList * l);

int present (char * letters, char c);
char * removeDuplicates (char * text);
int numChars(char * text, char c);
huffmanTreeList * makeHuffmanTreeList (char * text, char * lookUp);
huffmanTreeList * makeHuffmanTreeL(FILE *);
huffmanTreeList * addToHuffmanTreeList(huffmanTreeList * list, huffmanTree * t);
huffmanTreeList * reduceHuffmanTreeList(huffmanTreeList * h);
char * encode (char * text, huffmanTree * t);
char * decode(char * code, huffmanTree * t);
void makeCharTable(huffmanTree *h);
void help();
void compress(char *, char *);
void decompress(char *);
void writeToBinaryFile(char *, char *);
char * decimalToBinary(int);
char * getFileContent(char *);
void reduce(char *, int);
#endif
